package com.shinhye.demoproject.adapter;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.shinhye.demoproject.R;

/**
 * @author wl
 * @since 2016/08/09 14:44
 */
public class DrawerAdapter extends BaseAdapter {
    private int[] ics = new int[] {
            android.R.drawable.ic_dialog_email,
            android.R.drawable.ic_dialog_alert,
            android.R.drawable.ic_dialog_map,
            android.R.drawable.ic_dialog_info
    };
    private String[] strs = new String[] {
            "常见问答", "客户服务", "建议反馈", "关于我们"
    };
    @Override
    public int getCount() {
        return 4;
    }

    @Override
    public Object getItem(int position) {
        return null;
    }

    @Override
    public long getItemId(int position) {
        return 0;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        View content = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_drawer, null);
        ImageView iv = (ImageView) content.findViewById(R.id.iv);
        TextView tv = (TextView) content.findViewById(R.id.tv);

        iv.setImageResource(ics[position]);
        tv.setText(strs[position]);
        return content;
    }
}
